﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Xml.Linq;

namespace PreguntaAlExperto
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class rsd : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string rootUrl = String.Format("{0}://{1}:{2}/",
                context.Request.Url.Scheme, context.Request.Url.Host,
                context.Request.Url.Port);

            XDocument rsdDocument = new XDocument(new XElement("rsd",
                new XAttribute("version", "1.0"),
                new XElement("service", "Pae Content Publishing"),
                new XElement("engineLine",
                    "http://www.preguntaalexperto.net"),
                new XElement("homePageLink", rootUrl),
                new XElement("apis",
                    new XElement("api",
                        new XAttribute("name", "MetaWeblog"),
                        new XAttribute("preferred", "true"),
                        new XAttribute("apiLink", rootUrl + "MetablogApi.ashx"),
                        new XAttribute("blogID", "Artículos"))
            )));

            context.Response.Write(rsdDocument.ToString());
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
